import Vue from 'vue'

import DefaultLayout from '~/layouts/Default.vue'
import Vuetify from 'vuetify'
import 'vuetify/dist/vuetify.min.css'
// import './registerServiceWorker'

Vue.config.productionTip = false
export default function (Vue, {router, appOptions, head, isClient}) {
    // Set default layout as a global component
    head.link.push({
        rel: 'stylesheet',
        href: 'https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css',
    });

    head.link.push({
        rel: 'stylesheet',
        href: 'https://fonts.proxy.ustclug.org/css?family=Roboto:100,300,400,500,700,900',
    });
    head.link.push({
        rel: 'stylesheet',
        href: 'https://fonts.proxy.ustclug.org/icon?family=Material+Icons'
    })
    head.link.push({
        rel: 'stylesheet',
        href: 'https://use.fontawesome.com/releases/v5.10.2/css/all.css'
    })
    //百度统计
    head.script.push({
    src: 'https://hm.baidu.com/hm.js?0472eff0a20ee90255f559b03f43c8eb',
    body: true
  })
    const opts = {
        icons: {
            iconfont: 'fa', // 'mdi' || 'mdiSvg' || 'md' || 'fa' || 'fa4'
        },
    } //opts includes, vuetify themes, icons, etc.
    Vue.use(Vuetify)
    appOptions.vuetify = new Vuetify(opts);
    Vue.component('Layout', DefaultLayout)
    // router.beforeEach((to, from, next) => {
    //
    //     var _hmt = _hmt || [];
    //     (function () {
    //         var hm = document.createElement("script");
    //         hm.src = "https://hm.baidu.com/hm.js?0472eff0a20ee90255f559b03f43c8eb";
    //         var s = document.getElementsByTagName("script")[0];
    //         s.parentNode.insertBefore(hm, s);
    //     })();
    //     if (to.path) {
    //         _hmt.push(['_trackPageview', '/#' + to.fullPath]);
    //     }
    //     next();
    // });
    // window.onresize = () => {
    //       return (() => {
    //         Vue.prototype.screenWidth = document.body.clientWidth
    //       })()
    //     }
}
